{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "image 1/1 /home/youngqi/Downloads/ultralytics-main/ultralytics/assets/zidane.jpg: 384x640 2 persons, 1 tie, 50.4ms\n",
      "Speed: 1.6ms preprocess, 50.4ms inference, 0.6ms postprocess per image at shape (1, 3, 384, 640)\n",
      "Results saved to \u001b[1mruns/detect/predict5\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "from ultralytics import YOLO\n",
    "\n",
    "yolo = YOLO(\"./yolov8n.pt\",task=\"detect\")\n",
    "\n",
    "results = yolo(source=\"ultralytics/assets/zidane.jpg\",save=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[     614.67,      454.65,       999.6,      514.48],\n",
       "       [     945.77,      377.44,      394.61,      671.17],\n",
       "       [     481.91,      573.12,      84.871,      272.09]], dtype=float32)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0].boxes.xywh.cpu().numpy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "image 1/1 /home/youngqi/Downloads/ultralytics-main/ultralytics/assets/zidane.jpg: 384x640 2 persons, 1 tie, 58.5ms\n",
      "Speed: 4.5ms preprocess, 58.5ms inference, 0.8ms postprocess per image at shape (1, 3, 384, 640)\n"
     ]
    }
   ],
   "source": [
    "results = yolo(source=\"ultralytics/assets/zidane.jpg\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "yolov8py39",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
